package com.example.cd5160866.modelrecycleview.activity;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.cd5160866.modelrecycleview.R;

public class MainActivity extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String[] itmes = {"recyclerAdapter 原生实现", "modelAdapter实现", "header+footer", "demo4", "demo5", "demo6"};
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                R.layout.item_list_view, R.id.tv_itmes, itmes);
        this.setListAdapter(adapter);
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        switch (position) {
            case 0:
                startActivity(new Intent(this, Demo1Activity.class));
                break;
            case 1:
                startActivity(new Intent(this, Demo2Activity.class));
                break;
            case 2:
                startActivity(new Intent(this, Demo3Activity.class));
                break;
            case 3:
                startActivity(new Intent(this, Demo4Activity.class));
                break;
            case 4:
                startActivity(new Intent(this, Demo5Activity.class));
                break;
            default:
                break;
        }
        super.onListItemClick(l, v, position, id);
    }

}
